import {h, render} from 'vue'
import MessageComponent from './index.vue'

export default confirm = (type, content) => {
  return new Promise((resolve, reject) => {

      // 关闭的回调，销毁渲染的vnode
      const destory = () => {
        render(null, document.body)
      }

      const vnode = h(MessageComponent, {
        type,
        content,
        destory
      })

      render(vnode, document.body)
  })
}